package com.jsonp.controller;

import com.jsonp.service.FindCondition;
import com.jsonp.vo.PageBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.io.IOException;

@Controller
public class FindConditionController {
	@Resource
	FindCondition findCondition;

	/**
	 * 爬取输入关键字
	 * 
	 * @param string
	 * @return
	 */
	@RequestMapping(value = "FindConditionJSON", produces = "text/html;charset=UTF-8")
	public @ResponseBody
	String FindConditionJSON(String string) {

		String message = "程序异常!";
		try {
			message = findCondition.search(string);

		} catch (IOException e) {
			e.printStackTrace();
		}
		return message;
	}

	/**
	 * 获取对像列表
	 * 
	 * @param string
	 * @return
	 */
	@RequestMapping(value = "getJobBean", produces = "text/html;charset=UTF-8")
	public @ResponseBody
	String getJobBean(PageBean pageBean) {
		return findCondition.getJobBean(pageBean);
	}

	/**
	 * 屏蔽对应公司
	 * 
	 * @param string
	 * @return
	 */
	@RequestMapping(value = "shieldingCompany", produces = "text/html;charset=UTF-8")
	public @ResponseBody
	String shieldingCompany(String string) {

		return findCondition.shieldingCompany(string);
	}

	/**获取分页总数
	 * @param string
	 * @return
	 */
	@RequestMapping(value = "totalPages", produces = "text/html;charset=UTF-8")
	public @ResponseBody
	String totalPages(String string) {
		return findCondition.totalPages(string);
	}

}
